home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / cuj0696.zip / DWYER.ZIP / QFLOAT / MCONF.H < prev    next >
C/C++ Source or Header  |  1996-03-18  |  4KB  |  164 lines

  1. /*                            mconf.h
  2.  *
  3.  *    Common include file for math routines
  4.  *
  5.  *
  6.  *
  7.  * SYNOPSIS:
  8.  *
  9.  * #include "mconf.h"
  10.  *
  11.  *
  12.  *
  13.  * DESCRIPTION:
  14.  *
  15.  * This file contains definitions for error codes that are
  16.  * passed to the common error handling routine mtherr()
  17.  * (which see).
  18.  *
  19.  * The file also includes a conditional assembly definition
  20.  * for the type of computer arithmetic (IEEE, DEC, Motorola
  21.  * IEEE, or UNKnown).
  22.  *
  23.  * For Digital Equipment PDP-11 and VAX computers, certain
  24.  * IBM systems, and others that use numbers with a 56-bit
  25.  * significand, the symbol DEC should be defined.  In this
  26.  * mode, most floating point constants are given as arrays
  27.  * of octal integers to eliminate decimal to binary conversion
  28.  * errors that might be introduced by the compiler.
  29.  *
  30.  * For computers, such as IBM PC, that follow the IEEE
  31.  * Standard for Binary Floating Point Arithmetic (ANSI/IEEE
  32.  * Std 754-1985), the symbol IBMPC should be defined.  These
  33.  * numbers have 53-bit significands.  In this mode, constants
  34.  * are provided as arrays of hexadecimal 16 bit integers.
  35.  *
  36.  * To accommodate other types of computer arithmetic, all
  37.  * constants are also provided in a normal decimal radix
  38.  * which one can hope are correctly converted to a suitable
  39.  * format by the available C language compiler.  To invoke
  40.  * this mode, the symbol UNK is defined.
  41.  *
  42.  * An important difference among these modes is a predefined
  43.  * set of machine arithmetic constants for each.  The numbers
  44.  * MACHEP (the machine roundoff error), MAXNUM (largest number
  45.  * represented), and several other parameters are preset by
  46.  * the configuration symbol.  Check the file const.c to
  47.  * ensure that these values are correct for your computer.
  48.  *
  49.  */
  50.  
  51. /*
  52. Cephes Math Library Release 2.3:  March, 1995
  53. Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
  54. */
  55.  
  56.  
  57. /* Constant definitions for math error conditions
  58.  */
  59.  
  60. #define DOMAIN        1    /* argument domain error */
  61. #define SING        2    /* argument singularity */
  62. #define OVERFLOW    3    /* overflow range error */
  63. #define UNDERFLOW    4    /* underflow range error */
  64. #define TLOSS        5    /* total loss of precision */
  65. #define PLOSS        6    /* partial loss of precision */
  66.  
  67. #define EDOM        33
  68. #define ERANGE        34
  69.  
  70. /* Complex numeral.  */
  71. typedef struct CmplxStru
  72.     {
  73.     double r;
  74.     double i;
  75.     }cmplx;
  76.  
  77. /* Long double complex numeral.  */
  78. typedef struct CmplxStruLdbl
  79.     {
  80.     double r;
  81.     double i;
  82.     }cmplxl;
  83.  
  84. /* Type of computer arithmetic */
  85.  
  86. /* PDP-11, Pro350, VAX:
  87.  */
  88. /*define DEC 1*/
  89.  
  90. /* Intel IEEE, low order words come first:
  91.  */
  92. # if !defined(IBMPC)
  93. #    define IBMPC 1
  94. # endif
  95.  
  96. /* Motorola IEEE, high order words come first
  97.  * (Sun 680x0 workstation):
  98.  */
  99. /*#define MIEEE 1*/
  100.  
  101. /* UNKnown arithmetic, invokes coefficients given in
  102.  * normal decimal format.  Beware of range boundary
  103.  * problems (MACHEP, MAXLOG, etc. in const.c) and
  104.  * roundoff problems in pow.c:
  105.  * (Sun SPARCstation)
  106.  */
  107. /*define UNK 1*/
  108.  
  109. /* If you define UNK, then be sure to set BIGENDIAN properly. */
  110. # if !defined(BIGENDIAN)
  111. #    define BIGENDIAN    0
  112. # endif
  113.  
  114. /* Define this `volatile' if your compiler thinks
  115.  * that floating point arithmetic obeys the associative
  116.  * and distributive laws.  It will defeat some optimizations
  117.  * (but probably not enough of them).
  118.  *
  119.  * #define VOLATILE volatile
  120.  */
  121. #define VOLATILE
  122.  
  123. /* For 12-byte long doubles on an i386, pad a 16-bit short 0
  124.  * to the end of real constants initialized by integer arrays.
  125.  *
  126.  * #define XPD 0,
  127.  *
  128.  * Otherwise, the type is 10 bytes long and XPD should be
  129.  * defined blank (e.g., Microsoft C).
  130.  *
  131.  * #define XPD
  132.  */
  133. #define XPD
  134.  
  135. /* Define to ask for infinity support, else undefine. */
  136. /* #define INFINITIES 1 */
  137.  
  138. /* Define to ask for support of numbers that are Not-a-Number,
  139.    else undefine.  This may automatically define INFINITY in some files. */
  140. /* #define NANS 1 */
  141.  
  142. /* Define to support tiny denormal numbers, else undefine. */
  143. /* #define DENORMAL 1 */
  144.  
  145. /* Define to distinguish between -0.0 and +0.0.  */
  146. /* #define MINUSZERO 1 */
  147.  
  148. /* Define 1 for ANSI C atan2() function
  149.    See atan.c and clog.c. */
  150. # if !defined(ANSIC)
  151. #    define ANSIC 1
  152. # endif
  153.  
  154. /* Get ANSI function prototypes, if you want them. */
  155. #ifdef __STDC__
  156. #define ANSIPROT
  157. extern int mtherr ( char *, int );
  158. #else
  159. int mtherr();
  160. #endif
  161.  
  162. /* Variable for error reporting.  See mtherr.c.  */
  163. extern int merror;
  164.